layui.use(['form','layer','jquery'],function () {
    var form = layui.form;
    form.on('submit(layui-layer-btn0)',function (data) {
        var index;
        $.ajax({
            rul:'insertdevices',
            type:'POST',
            data:data.field,
            dataType:'json',
            beforeSend:function (re) {
                index = top.layer.msg('数据提交中，请稍候',{icon:16,time:false,shade:0.8});
            },
            success:function (d) {
                top.layer.close(index);
                top.layer.msg('添加成功！');
                layer.closeAll();
                parent.location.reload();
            }
        });
        return false;
    });
});